package com.zxp01.selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;

public class Z07_Select {
    public static void main(String[] args) throws InterruptedException {
        WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.get(Z06_Copy.url);
        driver.findElement(By.id("s-usersetting-top")).click();
        driver.findElement(By.xpath("//*[@id=\"s-user-setting-menu\"]/div/a[2]/span")).click();
        Thread.sleep(1500);
//        // 获取select元素对象,只适用于select下拉框
//        WebElement webElement=driver.findElement(By.name("gpc"));
//        Select select = new Select(webElement);
//        // 根据索引选择
//        select.selectByIndex(1);
//        // 根据value值选择
//        select.selectByValue("");
//        // 根据可见文本选择
//        select.selectByVisibleText("");


        // div下拉框直接定位
        driver.findElement(By.xpath("//*[@id=\"adv-setting-gpc\"]/div/div[1]/span")).click();
        driver.findElement(By.xpath("//*[@id=\"adv-setting-gpc\"]/div/div[2]/div[2]/p[2]")).click();

    }
}
